package com.nidu.demo.dict;

import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.nidu.demo.dict.dto.DictTypeAddCmd;
import com.nidu.demo.dict.dto.DictTypeListQry;
import com.nidu.demo.dict.dto.DictTypePageQry;
import com.nidu.demo.dict.dto.DictTypeUpdateCmd;
import com.nidu.demo.dict.api.SysDictTypeService;
import com.nidu.demo.dict.dto.DictTypeCO;
import com.nidu.demo.dict.executor.command.DictTypeAddCmdExe;
import com.nidu.demo.dict.executor.command.DictTypeDeleteCmdExe;
import com.nidu.demo.dict.executor.command.DictTypeUpdateCmdExe;
import com.nidu.demo.dict.executor.query.DictTypeListQryExe;
import com.nidu.demo.dict.executor.query.DictTypePageQryExe;
import com.nidu.demo.dict.executor.query.DictTypeSingleQryExe;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Set;

/**
 * 字典类型服务实现类
 *
 * @author auto
 */
@Service
@RequiredArgsConstructor
public class SysDictTypeServiceImpl implements SysDictTypeService {

    private final DictTypeAddCmdExe addCmdExe;
    private final DictTypeUpdateCmdExe updateCmdExe;
    private final DictTypeDeleteCmdExe deleteCmdExe;
    private final DictTypeSingleQryExe singleQryExe;
    private final DictTypeListQryExe listQryExe;
    private final DictTypePageQryExe pageQryExe;

    @Override
    public SingleResponse<DictTypeCO> add(DictTypeAddCmd cmd) {
        return addCmdExe.execute(cmd);
    }

    @Override
    public SingleResponse<DictTypeCO> update(DictTypeUpdateCmd cmd) {
        return updateCmdExe.execute(cmd);
    }

    @Override
    public Response delete(Long id) {
        return deleteCmdExe.execute(id);
    }

    @Override
    public Response delete(Set<Long> ids) {
        return deleteCmdExe.execute(ids);
    }

    @Override
    public SingleResponse<DictTypeCO> getById(Long id) {
        return singleQryExe.execute(id);
    }

    @Override
    public MultiResponse<DictTypeCO> list(DictTypeListQry qry) {
        return listQryExe.execute(qry);
    }

    @Override
    public PageResponse<DictTypeCO> page(DictTypePageQry qry) {
        return pageQryExe.execute(qry);
    }
} 